<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>无标题文档</title>
<script src="../resources/js/jquery-1.7.2.min.js"></script>
<script>
window.addEventListener("load",proChange);
var jsonserver='http://bi.911860.com/mobile-html5-rest';
//var jsonserver="http://192.168.37.116:8089/mobile-html5-rest/";
$(document).ready(function(e) {
	initPros();
  	$("#ps").change(function(){proChange()});
	$("#btn").click(function(){

		var u=jsonserver+"/wea/"+$("#cs").val();
		$.getJSON(u+".jsonp?callback=?",{},function(data){
			$("#show").html("");
			$("#show").html(data.cityName+"</br>"+data.weaDesc+"</br>"+data.wendu+"</br>"+data.sb.currentDay+"&nbsp;"+data.sb.currentTime+"</br>"+"<img src='"+data.weaImg+"'/>")
		});
		
	});
});
function initPros()
{
	var u1=jsonserver+"/wea/p/0";
	$.getJSON(u1+".jsonp?callback=?",{},function(data){
		$("#ps").children().remove();
		$.each(data,function(i,items){
			var op=$("<option>").val(items.code).text(items.name);
			op.appendTo($("#ps"));
		});
	});
}
function proChange()
{
	var u1=jsonserver+"/wea/p/"+$("#ps").val();
	$.getJSON(u1+".jsonp?callback=?",{},function(data){
		$("#cs").children().remove();
		$.each(data,function(i,items){
			var op=$("<option>").val(items.code).text(items.name);
			op.appendTo($("#cs"));
		});
	});
}
</script>
</head>

<body>
<div style="width:30%; height:40px;float:left">省份:<select id="ps"></select>&nbsp;&nbsp;&nbsp;&nbsp;城市:<select id="cs"></select>&nbsp;&nbsp;&nbsp;&nbsp; <button id="btn">确定</button></div>
<div style="float:left;width:60%;" id="show">

</div>

</body>
</html>
